var React = require('react');


var Bheader = require('../widget/Bheader');
var ajax = require('../tools/ajax');
var postAjax = require('../tools/postAjax');
var ServerIP = require('../tools/ServerIP');

module.exports = React.createClass({
    getInitialState: function () {
        return {
            theme:"Default",//Default/Blue
            Id:"",
            flag:false,
            logistics:[]//物流信息
        }
    },

    componentDidMount: function () {
        this.logistics();
    },
    /**通过orderId获取物流信息*/
    logistics(){
        var p=this;
        var orderId = localStorage.getItem("logisticsOrderId");
        postAjax("POST",ServerIP.ip+"/kOrderInfoController.do?getLogistics",{orderId:orderId},function(dt){
            if(dt && dt.status =="1"){
                var logistics = dt;
                console.log(logistics);
                p.setState({logistics:logistics});
            }else{
                console.log("暂无物流");
            }
        })
    },

    render: function (){
        var p = this;
        var logistics = p.state.logistics;
        return (
            <div className="main"  id="main">
                <Bheader theme={this.state.theme} title="查看物流" headr="false" hact="#myorders"></Bheader>
                <div className="logistics">
                    <ul>
                        <li className="title">物流状态<span className="rt">{logistics.state?logistics.state:"暂无物流"}</span></li>
                        <li>承运来源<span className="rt">{logistics.com}</span></li>
                        <li>运单编号<span className="rt">{logistics.nu}</span></li>
                    </ul>
                    <hr className="orderHr" />
                    <div className="logisticsInfo">
                        <h2>物流信息</h2>
                        <div className="info"></div>
                    </div>
                </div>
            </div>
        )
    }
});